package com.obelisco.modelo.dao.hibernate;

import java.io.Serializable;
import java.util.List;

import com.obelisco.modelo.dao.ITipoTransaccionDAO;
import com.obelisco.modelo.data.TipoTransaccion;

public class TipoTransaccionDAO extends HibernateDAO  implements ITipoTransaccionDAO {

	public TipoTransaccion findByPK(Serializable clave) {
		try {
			TipoTransaccion data = (TipoTransaccion) getHibernateTemplate().load(TipoTransaccion.class,clave);
			return data.getEstado().equals("B") ?  null : data;        	
        } catch (RuntimeException re) {
            throw re;
        }		
	}

	public List loadAll() {
		try {
			List lista = getHibernateTemplate().find(
			"from TipoTransaccion model where model.estado != 'B'");
			return lista;	
        } catch (RuntimeException re) {
            throw re;
        }		
	}

	public void delete(TipoTransaccion objeto) {
		// TODO Auto-generated method stub

	}

	public void save(TipoTransaccion objeto) {
		// TODO Auto-generated method stub

	}

	public List findByProperty(String propertyName, Object value) {
		// TODO Auto-generated method stub
		try {
			String queryString = "from TipoTransaccion modelo where modelo."
					+ propertyName + "= ?";
			return getHibernateTemplate().find(queryString, value);
		} catch (RuntimeException re) {
			// log.error("find by property name failed", re);
			throw re;
		}
	}

}
